﻿<UserControl x:Class="Skynet.C2SModule.Views.AuthorsDSMgmt.AuthorDSTest"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="600" d:DesignWidth="600" xmlns:my="clr-namespace:Skynet.C2SModule.Models" Loaded="UserControl_Loaded">
    <UserControl.Resources>
        <my:SkynetLibraryDS x:Key="skynetLibraryDS" />
        <CollectionViewSource x:Key="authorsViewSource" Source="{Binding Path=Authors, Source={StaticResource skynetLibraryDS}}" />
        <CollectionViewSource x:Key="booksViewSource" Source="{Binding Path=Books, Source={StaticResource skynetLibraryDS}}" />
    </UserControl.Resources>
    <Grid DataContext="{StaticResource booksViewSource}">
        <Grid DataContext="{StaticResource authorsViewSource}" HorizontalAlignment="Left" Margin="12,22,0,0" Name="grid1" VerticalAlignment="Top">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Label Content="Id:" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="0" Height="23" HorizontalAlignment="Left" Margin="3" Name="idTextBox" Text="{Binding Path=Id, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="First Name:" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="1" Height="23" HorizontalAlignment="Left" Margin="3" Name="firstNameTextBox" Text="{Binding Path=FirstName, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="Last Name:" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="3" Name="lastNameTextBox" Text="{Binding Path=LastName, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="Web Site:" Grid.Column="0" Grid.Row="3" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="3" Height="23" HorizontalAlignment="Left" Margin="3" Name="webSiteTextBox" Text="{Binding Path=WebSite, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="Photo:" Grid.Column="0" Grid.Row="4" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="4" Height="23" HorizontalAlignment="Left" Margin="3" Name="photoTextBox" Text="{Binding Path=Photo, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
        </Grid>
        <DataGrid AutoGenerateColumns="False" EnableRowVirtualization="True" Height="200" HorizontalAlignment="Left" ItemsSource="{Binding}" Margin="54,194,0,0" Name="booksDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected" VerticalAlignment="Top" Width="400">
            <DataGrid.Columns>
                <DataGridTextColumn x:Name="idColumn" Binding="{Binding Path=Id}" Header="Id" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="isbnColumn" Binding="{Binding Path=Isbn}" Header="Isbn" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="notesColumn" Binding="{Binding Path=Notes}" Header="Notes" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="pageCountColumn" Binding="{Binding Path=PageCount}" Header="Page Count" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="priceColumn" Binding="{Binding Path=Price}" Header="Price" Width="SizeToHeader" />
                <DataGridTemplateColumn x:Name="publicationDateColumn" Header="Publication Date" Width="SizeToHeader">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <DatePicker SelectedDate="{Binding Path=PublicationDate, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTextColumn x:Name="summaryColumn" Binding="{Binding Path=Summary}" Header="Summary" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="titleColumn" Binding="{Binding Path=Title}" Header="Title" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="authorIdColumn" Binding="{Binding Path=AuthorId}" Header="Author Id" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="publisherIdColumn" Binding="{Binding Path=PublisherId}" Header="Publisher Id" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="subjectIdColumn" Binding="{Binding Path=SubjectId}" Header="Subject Id" Width="SizeToHeader" />
            </DataGrid.Columns>
        </DataGrid>
    </Grid>
</UserControl>
